package com.ctshk.rpc.order.air.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ctshk.rpc.order.air.entity.AirOrder;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;



/**
 * <p>
 * 机票订单 Mapper 接口
 * </p>
 *
 * @author lihang
 * @since 2021-03-15
 */
public interface AirOrderMapper extends BaseMapper<AirOrder> {

    /**
     * 订单列表分页连表查询  ew 为固定参数写法 不能修改
     * @param page
     * @param queryWrapper
     * @return
     */
    @Select("SELECT  o.id,o.order_number,o.trip_type,o.order_amount,o.payment_status,o.salesman_id,o.salesman_name,o.gmt_create,o.scheduled_status,o.source,o.contact_name" +
            ",o.order_type,o.order_status\n" +
            " FROM  t_air_order as o LEFT JOIN t_air_order_flight as f ON o.id = f.order_id "+
            " ${ew.customSqlSegment} order by o.gmt_create DESC")
    Page<AirOrder> queryList(Page<AirOrder> page, @Param("ew") Wrapper queryWrapper);
}
